package com.zyg.mapper;

import com.zyg.page.Page;
import com.zyg.pojo.Room;
import com.zyg.pojo.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@CacheNamespace
public interface StudentMapper {

    //查询学生及全部课程
    public Student selectStudentAndCourseById(Integer id);

    //查询学生及教室
    public Student selectStudentAndRoomById(Integer id);

    //查询学生及教室
    public Room selectRoomById(Integer rid);


    //查询全部
    @Select("SELECT * FROM student")
    public abstract List<Student> selectPage(Page page);


    //查询全部
    @Select("SELECT * FROM student")
    public abstract List<Student> selectAll();

    //新增操作
    @Insert("INSERT INTO student VALUES (#{id},#{name},#{age})")
    public abstract Integer insert(Student stu);

    //修改操作
    @Update("UPDATE student SET name=#{name},age=#{age} WHERE id=#{id}")
    public abstract Integer update(Student stu);

    //删除操作
    @Delete("DELETE FROM student WHERE id=#{id}")
    public abstract Integer delete(Integer id);
}
